/*
 ============================================================================
 Name		: fReaderAppUi.cpp
 Author	  : wangchao
 Copyright   : Your copyright notice
 Description : CfReaderAppUi implementation
 ============================================================================
 */

// INCLUDE FILES
#include <avkon.hrh>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <f32file.h>
#include <s32file.h>
#include <hlplch.h>

#include <fReader_0xEA7F598A.rsg>

#include "fReader.hrh"
#include "fReader.pan"
#include "fReaderApplication.h"
#include "fReaderAppUi.h"
#include "fReaderAppView.h"
#include "fReaderWidget.h"
// ============================ MEMBER FUNCTIONS ===============================


// -----------------------------------------------------------------------------
// CfReaderAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CfReaderAppUi::ConstructL( )
{
    // Initialise app UI with standard value.
    BaseConstructL( CAknAppUi::EAknEnableSkin );
    
    // Create view object
    iAppView = CfReaderAppView::NewL( ApplicationRect( ) );
    
    // TODO add your code here
    AddToStackL( iAppView );
    iAppView->Widget( )->excute( );
}
// -----------------------------------------------------------------------------
// CfReaderAppUi::CfReaderAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CfReaderAppUi::CfReaderAppUi( )
{
    // No implementation required
}

// -----------------------------------------------------------------------------
// CfReaderAppUi::~CfReaderAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CfReaderAppUi::~CfReaderAppUi( )
{
    if( iAppView )
    {
        RemoveFromStack( iAppView );
        delete iAppView;
        iAppView = NULL;
    }
}

// -----------------------------------------------------------------------------
// CfReaderAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CfReaderAppUi::HandleCommandL( TInt aCommand )
{
    switch( aCommand )
    {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit( );
            break;
        default:
            Panic( EfReaderUi );
            break;
    }
}

TKeyResponse CfReaderAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
{                         
    iAppView->Widget( )->handleKeyEvent( fKeyEvent( aKeyEvent, aType ) );
    return EKeyWasConsumed;
}

// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CfReaderAppUi::HandleStatusPaneSizeChange( )
{
    iAppView->SetRect( ClientRect( ) );
}

// End of File
